<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>贪吃蛇游戏</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div id="game-container">
        <header class="game-header">
            <h1>🐍 贪吃蛇游戏</h1>
            <div class="header-controls">
                <div id="score-display">分数: 0</div>
                <button id="achievements-button" class="header-btn">🏆 成就</button>
            </div>
        </header>
        
        <div class="game-settings">
            <div id="difficulty-section">
                <label for="difficulty-select">难度:</label>
                <select id="difficulty-select">
                    <option value="1">简单</option>
                    <option value="2">中等</option>
                    <option value="3">困难</option>
                </select>
            </div>
            <div id="audio-controls">
                <button id="audio-toggle" class="setting-btn">
                    🔊 音效
                </button>
            </div>
        </div>
        
        <div id="stats-info" class="stats-bar">
            <span id="games-played">游戏次数: 0</span>
            <span id="highest-score">最高分: 0</span>
            <span id="achievements-unlocked">成就: 0/9</span>
        </div>
        <div id="game-area">
            <div class="game-main">
                <div id="game-board-container">
                    <canvas id="game-board" width="500" height="500"></canvas>
                </div>
                <div id="controls-section">
                    <div class="control-buttons">
                        <button id="start-button" class="game-btn primary">开始游戏</button>
                        <button id="pause-button" class="game-btn secondary">暂停</button>
                        <button id="retry-button" class="game-btn tertiary" style="display: none;">重试</button>
                    </div>
                    <div id="instructions" class="instructions-compact">
                        <div class="instruction-item">
                            <span class="key-hint">WASD/方向键</span>
                            <span>移动</span>
                        </div>
                        <div class="instruction-item">
                            <span class="key-hint">P</span>
                            <span>暂停</span>
                        </div>
                    </div>
                </div>
            </div>
            <div id="mobile-controls" class="mobile-controls-optimized">
                <div class="key-row">
                    <div class="key" id="up-key">↑</div>
                </div>
                <div class="key-row">
                    <div class="key" id="left-key">←</div>
                    <div class="key" id="down-key">↓</div>
                    <div class="key" id="right-key">→</div>
                </div>
            </div>
        </div>
        
        <div id="message-display"></div>
        
        <!-- 成就榜弹窗 -->
        <div id="achievements-overlay" class="overlay" style="display: none;">
            <div id="achievements-modal" class="modal">
                <div class="modal-header">
                    <h3>🏆 成就榜</h3>
                    <button id="close-achievements" class="close-btn">×</button>
                </div>
                <div id="achievements-display" class="modal-content"></div>
                <div class="modal-footer">
                    <p class="achievement-tip">完成成就可获得特殊奖励！</p>
                </div>
            </div>
        </div>
    </div>
    <script src="script.js" defer></script>
</body>
</html>